package com.formula.propertyshop.view.common;

import android.graphics.Bitmap;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.ImageView;

import com.formula.propertyshop.R;
import com.google.android.gms.maps.GoogleMap.InfoWindowAdapter;
import com.google.android.gms.maps.model.Marker;

public class CustomInfoWindowAdapter implements InfoWindowAdapter{

	private  View mWindow;
	private  Bitmap icon;
	public CustomInfoWindowAdapter(FragmentActivity context) {
		mWindow = context.getLayoutInflater().inflate(R.layout.custom_info_window, null);
	}
	public void setIcon(Bitmap bm){
		this.icon = bm;
	}
	@Override
	public View getInfoContents(Marker arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public View getInfoWindow(Marker marker) {
		render(marker, mWindow);
		return mWindow;
	}
	private void render(Marker marker, View view) {
		if(icon!=null)
		((ImageView) view.findViewById(R.id.badge)).setImageBitmap(icon);
	}
}
